<form id="learn-proccess-form" lay-filter="learn-proccess-form" class="layui-form model-form">
    <input name="lepcid" type="hidden"/>
    <div class="layui-form-item">
        <label class="layui-form-label">阶段名</label>
        <div class="layui-input-block">
            <input name="stitle"  type="text" class="layui-input" autocomplete="off" disabled readonly/>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">学习总结</label>
        <div class="layui-input-block">
            <textarea name="summar" id="summar" class="layui-textarea" ></textarea>
        </div>
    </div>

    <div class="layui-form-item model-form-footer">
        <button class="layui-btn layui-btn-primary" ew-event="closeDialog" type="button">取消</button>
        <button class="layui-btn" lay-filter="learn-proccess-form-submit" lay-submit>保存</button>
    </div>
</form>
<script>
    layui.use(['layedit','admin','form','layer'],function () {
        var layedit = layui.layedit,
            form = layui.form,
            layer = layui.layer,
            admin = layui.admin;
        //富文本框
        var index = layedit.build('summar',{
            height:300
        });
        // 回显数据
        var learn = admin.getTempData('t_learn_proccess');
        form.val('learn-proccess-form', learn);
        layedit.setContent(index,learn.summar,false);
        $('#learn-proccess-form').attr('method', 'POST');

        // 表单提交事件
        form.on('submit(learn-proccess-form-submit)',function (data) {
            data.field.summar = layedit.getContent(index);
            console.log(data.field);
            layer.load(2);
            admin.req('api-study/learnRate/update', JSON.stringify(data.field), function (data) {
                layer.closeAll('loading');
                if (data.code === 0) {
                    layer.msg(data.msg, {icon: 1, time: 500});
                    admin.finishPopupCenter();
                } else {
                    layer.msg(data.msg, {icon: 2, time: 500});
                }
            }, 'POST');
            return false;
        });
    });
</script>